//
//  UtilsTool.swift
//  Mall-swift
//
//  Created by dfpo on 2020/10/15.
//  Copyright © 2020 Bob. All rights reserved.
//

import Foundation

/// 延迟多少秒闭包，如延迟1秒: delay(1) { // do somethin }
/// - Parameters:
///   - delay: 延迟秒数
///   - closure: 闭包
func delay(_ delay:Double, closure:@escaping ()->()) {
    let when = DispatchTime.now() + delay
    DispatchQueue.main.asyncAfter(deadline: when, execute: closure)
}
